Comparison between Wiki-Vote, Random, Watts-Strogatz and Generalized Watts-Strogatz graphs


In [3]:
#!/usr/bin/python
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from stats import parse_results
from stats import graph_stats
from stats import draw_avg_infected

Parse data


In [9]:
wv_pr, wv_eigen, wv_bet = parse_results('test_wikivote.txt')
rg_pr, rg_eigen, rg_bet = parse_results('test_rdbg.txt')
ws_pr, ws_eigen, ws_bet = parse_results('test_ws.txt')
gws_pr, gws_eigen, gws_bet = parse_results('test_genws.txt')

PageRank comparison


In [6]:
pr_matrix = np.column_stack((wv_pr[:,1], rg_pr[:,1], ws_pr[:,1], gws_pr[:,1]))
draw_avg_infected(np.mean(pr_matrix, 0),title='Page Rank', xlabel='Graph', ylabel='Infected')


Eigenvector comparison


In [7]:
eigen_matrix = np.column_stack((wv_eigen[:,1], rg_eigen[:,1], ws_eigen[:,1], gws_eigen[:,1]))
draw_avg_infected(np.mean(eigen_matrix, 0),title='Eigenvector', xlabel='Graph', ylabel='Infected')


Betweenness comparison


In [8]:
bet_matrix = np.column_stack((wv_bet[:,1], rg_bet[:,1], ws_bet[:,1], gws_bet[:,1]))
draw_avg_infected(np.mean(bet_matrix, 0),title='Betweenness', xlabel='Graph', ylabel='Infected')